<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>vue-list</title>
    <link rel="stylesheet" href="./static/css/bootstrap.min.css" type="text/css">
    <script src="./static/vue2.js"></script>
    <style>
        .page li{ display:block; float:left; margin-left:5px; border:1px solid #999; padding:10px; }
        .page li a{ color:#67b168;}
        .active{ background-color:#d0e9c6}
    </style>
</head>
<body>
    <div class="container" id="app">
        <h1>{{ title }}</h1>
        <div class="row">
            <ul>
                <li></li>
                <li v-show="age >= 25">{{ age }}</li>
                <li>
                    <span v-if="sex == 1">男</span>
                    <span v-else>女</span>
                </li>
            </ul>

            <ul>

                <li v-for="v in news">
                    {{ v.title }} - {{ v.pubdate }}
                </li>
            </ul>

            <ul class="page">
                <li v-for="i in pages" @click="removePage(i)" :class=" curPage == i ? 'active' : ''"><a href="">{{ i }}</a></li>
            </ul>
        </div>
    </div>
    <script>
        var setModel={
            title : 'Hello World!',
            age : 32,
            sex : 1,
            news:[{
                title:'第1条新闻啊啊啊',
                pubdate:'2017-07-21'
            },{
                title:'第2条新闻啊啊啊',
                pubdate:'2017-07-22'
            },{
                title:'第3条新闻啊啊啊',
                pubdate:'2017-07-23'
            },{
                title:'第4条新闻啊啊啊',
                pubdate:'2017-07-24'
            }],
            curPage:2,
            pages:10
        }
        var app = new Vue({
            el: '#app',
            data: setModel,
            methods:{
                removePage:function(page){
                    alert(page);
                }
            }

        })
    </script>
</body>
</html>